package com.huawei.appmarket.service.settings.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.widget.LinearLayout;
import com.huawei.appmarket.service.settings.card.BaseSettingCard;
import o.azb;
import o.cht;
import o.cih;
import o.der.d;
import o.der.g;

public abstract class BaseSettingNode extends cht {
    protected LayoutInflater ˊ;

    public abstract int ˋ();

    public abstract BaseSettingCard ˎ();

    public BaseSettingNode(Context context) {
        super(context, 1);
        this.ˊ = LayoutInflater.from(context);
    }

    public boolean ॱ() {
        return true;
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        layoutParams.weight = 1.0f;
        View ˋ = ˋ(this.ˊ, g.ॱʻ);
        if (ˋ != null) {
            LinearLayout linearLayout = (LinearLayout) ˋ.findViewById(d.ʾˊ);
            View findViewById = ˋ.findViewById(d.ʾˋ);
            int ʼ = ʼ();
            ˎ(findViewById, ʼ);
            findViewById = this.ˊ.inflate(ˋ(), null);
            ॱ(findViewById, ʼ);
            linearLayout.addView(findViewById);
            cih ˎ = ˎ();
            ˎ.ˏ(ˋ);
            ˊ(ˎ);
            viewGroup.addView(ˋ, layoutParams);
        }
        return true;
    }

    protected int ʼ() {
        return azb.ˊ(this.ॱ);
    }

    protected View ˋ(LayoutInflater layoutInflater, int i) {
        if (layoutInflater == null) {
            return null;
        }
        return (LinearLayout) layoutInflater.inflate(i, null);
    }

    private void ॱ(View view, int i) {
        if (view != null) {
            int ʼ = ʼ();
            view.setPadding(ʼ, view.getPaddingTop(), ʼ, view.getPaddingBottom());
        }
    }

    private void ˎ(View view, int i) {
        if (view != null) {
            MarginLayoutParams marginLayoutParams = (MarginLayoutParams) view.getLayoutParams();
            marginLayoutParams.leftMargin = i;
            marginLayoutParams.rightMargin = i;
            view.setLayoutParams(marginLayoutParams);
        }
    }
}
